package per.ethan.cloud.consumer.service.impl;

import cn.hutool.http.HttpStatus;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import per.ethan.cloud.common.domain.ErrorCodeVO;
import per.ethan.cloud.common.domain.ResultBean;
import per.ethan.cloud.consumer.entity.Balance;
import per.ethan.cloud.consumer.service.ProviderBalanceService;

/**
 * @author Ethan
 * @date 2020/04/13 13:54
 */
@Slf4j
@Component
public class ProviderBalanceServiceFallbackImpl implements ProviderBalanceService {
    @Override
    public ResultBean<Boolean> modify(Balance balance) {
        log.error("微服务调用失败: {}", JSONUtil.toJsonStr(balance));
        return ResultBean.error(new ErrorCodeVO(HttpStatus.HTTP_INTERNAL_ERROR, "微服务调用异常"));
    }
}
